<?php
if(CHILDTEMPLATEPATH && file_exists(CHILDTEMPLATEPATH . '/product_listing_page_above_title.php'))
{
	include_once(CHILDTEMPLATEPATH . '/product_listing_page_above_title.php');
}
?>
<?php /*?><div class="page_title"><h1 ><?php echo single_cat_title(); ?> </h1>     <span class="sticky-link"><span class="link-holder"><a href="#" class="switch_thumb swap"><?php _e('Switch View');?></a></span></span>
 </div><?php */?>
    <div class="breadcrumb clearfix">
    <?php if ( get_option( 'ptthemes_breadcrumbs' )) { yoast_breadcrumb('',''); } ?>
    </div>
<?php
if(CHILDTEMPLATEPATH && file_exists(CHILDTEMPLATEPATH . '/product_listing_page_below_title.php'))
{
	include_once(CHILDTEMPLATEPATH . '/product_listing_page_below_title.php');
}
global $wp_query;
$current_term = $wp_query->get_queried_object();
if($current_term->category_description)
{
	echo '<p class="cat_desc">'.$current_term->category_description.'</p>';	
}
if(CHILDTEMPLATEPATH && file_exists(CHILDTEMPLATEPATH . '/product_listing_page_below_cat_desc.php'))
{
	include_once(CHILDTEMPLATEPATH . '/product_listing_page_below_cat_desc.php');
}
?>       
   <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/jquery-latest.js"></script>
   <?php $General->get_product_listing_thumb_view_js('category');

	 if(have_posts())
	 {
 ?>
      <div class="sorting fr">
      	  <?php
	  	if($_REQUEST['sorting']!=''){
		$sorting = $_REQUEST['sorting'];
		if($sorting!="latest"){
		query_posts($query_string.'&meta_key=key_sprice&orderby=meta_value_num&order='.$sorting.'');
		}else{
			query_posts($query_string.'&orderby=date&order=desc');
		}
		}
		?>
      <label>SORT BY :</label>
      <a class="sort <?php if($sorting=="latest") echo 'active';?>" rel="latest">Latest</a>
      <a class="sort <?php if($sorting=="asc") echo 'active';?>" rel="asc">Price low-to-high</a>
      <a class="sort <?php if($sorting=="desc") echo 'active';?>" rel="desc">Price high-to-low</a>
	       <script type="text/javascript">
        	$('.sorting .sort').click(function(){
					var option_value = 	$(this).attr('rel');
					var url = '<?php echo bloginfo('url').'/?'.$query_string; ?>&sorting='+option_value;    
					$(location).attr('href',url);
				 });
        </script>
      </div>

      <ul style="display:block;" class="display <?php echo $General->archive_listing_format();?>">
        <?php
		 while(have_posts())
        {
			
            the_post();
            $data = get_post_meta( $post->ID, 'key', false );
			$Product->product_listing_li($post);
        }
  		?>
      </ul>
<?php
if(CHILDTEMPLATEPATH && file_exists(CHILDTEMPLATEPATH . '/product_listing_page_above_pagination.php'))
{
	include_once(CHILDTEMPLATEPATH . '/product_listing_page_above_pagination.php');
}
?>       <div class="pagination">
        <div class="Navi">
          <?php if (function_exists('wp_pagenavi')) { ?>
          <?php wp_pagenavi(); ?>
          <?php } ?>
        </div>
      </div>
      <?php
 }
 ?>
<?php
if(CHILDTEMPLATEPATH && file_exists(CHILDTEMPLATEPATH . '/product_listing_page_below_pagination.php'))
{
	include_once(CHILDTEMPLATEPATH . '/product_listing_page_below_pagination.php');
}
?> 